﻿@{
    Layout = null;
}

<head>
    <title>权限信息</title>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <link rel="stylesheet" type="text/css" href="~/H-ui/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="~/H-ui/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="~/H-ui/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="~/H-ui/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="~/H-ui/static/h-ui.admin/css/style.css" />
    <link href="~/css/img.css" rel="stylesheet" />

    <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    <link href="~/bootstrap-star-rating-master/css/star-rating.css" rel="stylesheet" type="text/css" />
    <script src="~/bootstrap-star-rating-master/js/star-rating.js" type="text/javascript"></script>
</head>
<body class="bb1">
    <div align=center class="d1">
        <marquee style="FONT-SIZE: 35pt; WIDTH: 400px; FILTER: shadow(color=#AF0530); LINE-HEIGHT:15pt; FONT-FAMILY: 隶书; HEIGHT: 80px" scrollamount=6>
            <h2 style="margin-top:0px;text-align:center" ><font color=#f90b46>权限信息 </font></h2>
        </marquee>
    </div>
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> <a href="javascript:;" onclick="location.href='/Home/AddPermission'" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>  添加权限</a></span></div>
    <table class="table table-border table-bordered table-hover table-bg table-sort">
        <tr class="text-c">
            <th><input type="checkbox" id="check" onclick="CheckAll()" />全选</th>
            <th>权限Id</th>
            <th>权限名称</th>
            <th>父级权限名称</th>
            <th>权限路径</th>
            <th>操作</th>
        </tr>
        @foreach (var a in ViewBag.list)
        {
            <tr class="text-c">

                <td><input type="checkbox" name="checkid" class="b" value="@a.PermissionId" /></td>
                <td>@a.PermissionId</td>
                <td>@a.PermissionName</td>
                <td><span id="span1">@Html.Raw(a.PermissionUrl == "" ? "无" : (a.PermissionParent == 1 ? "权限管理" : a.PermissionParent == 2 ? "角色管理" : a.PermissionParent == 3 ? "用户管理" : a.PermissionParent == 4 ? "配件管理" : a.PermissionParent == 11 ? "报修管理" : a.PermissionParent == 16 ? "维修管理" : ""))</span></td>
                <td>@a.PermissionUrl</td>
                <td><button type="button" onclick="admin_upd('编辑角色', '/Home/UpdPermission/@a.PermissionId', '600', '500')" class="btn btn-primary radius"><i class="Hui-iconfont"></i> 编辑</button></td>
            </tr>
        }
    </table>
    <!--分页-->
    <nav class=" text-center">
        <ul id="pagination"></ul>
    </nav>
    <footer class="footer mt-20">
        <div class="container">
            <p>
                关于我们  |  联系我们    |  项目合作  |  广告植入   |  友情链接<br />
                版权所有 京ICP备11009069<br />
                Copyright ©2016 Gaotie.cn
            </p>
        </div>
    </footer>
</body>

<script type="text/javascript" src="~/H-ui/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="~/H-ui/lib/layer/2.4/layer.js"></script>
<script src="~/H-ui/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="~/H-ui/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Pageer/esimakin-twbs-pagination/jquery.twbsPagination.min.js"></script>
<script type="text/javascript" src="~/H-ui/lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript" src="~/H-ui/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="~/H-ui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="~/H-ui/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

    $(function () {
        $('#pagination').twbsPagination({
            totalPages: '@ViewBag.TotalPage',
            visiblePages: 3,
            first: "首页",
            prev: "上一页",
            next: "下一页",
            last: "尾页",
            href: '/Home/ShowPermission/?PageIndex={{pageNumber}}',
            hrefVariable: '{{pageNumber}}'
        });
    })


    //添加组题策略
    function admin_add(title, url, w, h) {
        layer_show(title, url, w, h);
    }
    layer.close()

    function admin_upd(title, url, w, h) {
        layer_show(title, url, w, h);
    }
    layer.close()
    //全选
    function CheckAll() {
        var ck = document.getElementById("check").checked;

        var k = document.getElementsByName("checkid");
        for (var c in k) {
            k[c].checked = ck;

        }
    }
    //删除
    function datadel() {
        var id = "";
        for (var i = 0; i < $(".b").length; i++) {
            if ($(".b").eq(i).attr("checked") == "checked") {
                id += $(".b").eq(i).val() + ",";
            }
        }
        if (id.length == 0) {
            alert('至少选择一个')
            return;
        }
        else {
            $.ajax({
                type: "post",
                url: "/Home/PermissionDelete",
                data: { id: id},
                success: function (obj) {
                    if (obj) {
                        alert('删除成功')
                        location.href = "/Home/ShowPermission";
                        return;
                    }
                    alert('删除失败')
                }
            })
        }
    }




</script>